# Makefile

CC = g++
#DEBUG = -DDEBUG=1
DEBUG =
CFLAGS = -g -Wall $(DEBUG)
LD = g++
LDFLAGS = 
LIBS =  -lpthread 
INCLUDES =
SRCS = Main.cpp Peer.cpp Status.cpp Host.cpp File.cpp Jobs.cpp
OBJS := $(SRCS:.cpp=.o)
FINAL = Fileshare 

all: clean $(FINAL)

$(FINAL): ${OBJS}
	${LD} ${LDFLAGS} ${INCLUDES} -o $@ $^ ${LIBS}

.cpp.o:
	${CC} ${CFLAGS} ${INCLUDES} -c $<

test: all test_setup

test_setup: $(FINAL)
	for number in 1 2 3 4 5 6 ; do \
        rm -f ../TESTING/Peer$${number}/$(FINAL); \
        cp $(FINAL) ../TESTING/Peer$${number}; \
    done

clean:
	rm -f *~ *.o $(FINAL)

# DO NOT DELETE

